const express = require("express");
const router = express.Router();
const { conMysql } = require("../db");


//根据uid查询业务员信息
router.get("/querySalespersonByUid", (req, res) => {
    let { uid } = req.query;

    //根据uid查询业务员信息
    const sql = `select uid,uname,uphone,uphoto,enterprises,position,createTime from db_salesperson where uid='${uid}'`;
    conMysql(sql)
        .then((result) => {
            if (result.length == 0) {
                res.output("业务员不存在", 1001, null);
                return;
            }
            res.output("查询成功", 0, result[0]);
        })
        .catch((err) => {
            console.log(err);
            res.output(err, 500, null);
        });
})

module.exports = router;